package com.itcast.stargraph.config;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * ollama大模型配置
 *
 * @Author katana
 * @Date 2025/6/11 10:08
 */
@Configuration
public class OllamaConfig {
    @Value("${qwen.apikey}")
    private String apiKey;
    
    @Value("${qwen.apiUrl}")
    private String apiUrl;
    
    
    /**
     * 创建ollama客户端
     *
     * @return ollama客户端
     */
    @Bean
    public OpenAIClient ollamaClient() {
        System.out.println(apiKey);
        OpenAIClient client = OpenAIOkHttpClient.builder()
                .apiKey(apiKey)
                .baseUrl(apiUrl)
                .build();
        return client;
    }
}
